
#include "TUIParse.h"

extern TUI_METHOD_ENTRY TUI_method_map[];
extern int size_TUI_method_map;
int TUI_parseRecv(unsigned char* buffer,int num)
{
  int i = 0;
  m_TUIStatus.waitTime = 0;
  if(num < 4)
    return 0;
  if(buffer[0]!= 0x5a || buffer[1]!= 0xa5)
    return 0;
  if(buffer[3] = 0x83) //recv the variable
  {
    unsigned short Addr       = (buffer[4] << 8) + buffer[5];
    unsigned char  dataLength = buffer[6];

    for(i=0;i<size_TUI_method_map;i++)
    {
      if(Addr >= TUI_method_map[i].IDStart && Addr <= (TUI_method_map[i].IDStart + TUI_method_map[i].IDRange))
      {
        TUI_method_map[i].operate(buffer,num,TUI_method_map[i].staticParam);
      }
    }
  }
  return 1;
}

